<?php require_once("includes/security.php"); ?>	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
window.print();
</script>
<style media="print">
  .noPrint{ display: none; }
  .yesPrint{ display: block !important; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>קליניקה נטורופתית</title>

<?php 	
require_once("includes/initializeSession.php");
require("includes/openConnection.php");

if(isset($_POST['submit'])) 
	{
		
		if($_POST['submit']=="שלח")
			{
				if(mysql_query("INSERT INTO quiz (`id`, `qstn`) VALUES (NULL, '{$_POST['qst']}');"))
				echo "השאלה התווספה בהצלחה";
				else
				echo "השאלה לא התווספה בהצלחה";
			}
			
			else if($_POST['submit']=="מחק")
			{
				if(isset($_POST['qusID']))
				{
				$qusID=$_POST ['qusID'];
				if(mysql_query("DELETE FROM quiz WHERE ID ='$qusID'"))
							echo "שאלה נמחקה בהצלחה";
							else
							echo "השאלה לא נמחקה";
				}
			}
		
				
}//end submit
	

?>

</head>

<body >
<container id="container">
  <?php require("header.php"); ?>
      <content id="content" class="yesPrint">
      <contentTitle id="contentTitle">
      שאלון רפואי
      </contentTitle>
      <contentText id="contentText">
 <subContentTitle id="subContentTitle"></subContentTitle>	
 <form name="form" action="#" method="post" enctype="multipart/form-data">
		<table id="quiz" >
<?php
$result = mysql_query("SELECT * FROM quiz")or die ('אין דף כזה'.mysql_error());
			while($row = mysql_fetch_array($result))
			{
		echo "
        <tr>
            <td>
         שאלה  :
            </td>
            <td >
             {$row['qstn']}
			 <input type=radio name={$row['id']} value=כן>כן
<input type=radio name={$row['id']} value=לא>לא

	<td></tr>";
}
require_once("includes/closeConnection.php");	
?>
</table>
</form> 

</contentText>
      </content>
</container>
    
     
    
</body>
</html>
